package vista;

import java.awt.Frame;

import javax.swing.*;

import controle.*;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.Dimension;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class GUIinicio extends Frame{
	
	JFrame janela;
	Main mainInicio;
	
	/**
	 * @wbp.parser.entryPoint
	 */
	public GUIinicio (Main m) {
		
		mainInicio = m;
		mainInicio.cenario = m.cenario;
		mainInicio.game = m.game;
		mainInicio.aberto = m.aberto;
		
		janela = new JFrame();
		janela.getContentPane().setBackground(Color.BLACK);
		janela.setTitle("GuitaRPG");
		janela.setVisible(true);
		janela.setExtendedState(JFrame.MAXIMIZED_BOTH);
		janela.setResizable(false);
		janela.getContentPane().setLayout(new BorderLayout(0, 0));
		janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JPanel panel = new JPanel();
		panel.setBackground(Color.ORANGE);
		janela.getContentPane().add(panel, BorderLayout.SOUTH);
		panel.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 15));
		
		JButton btnNewButton = new JButton("NOVO JOGO");
		btnNewButton.setHorizontalTextPosition(SwingConstants.CENTER);
		btnNewButton.setPreferredSize(new Dimension(120, 100));
		OuvinteBotaoNovoJogo ouvinte1 = new OuvinteBotaoNovoJogo();
		btnNewButton.addActionListener(ouvinte1);
		panel.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("CARREGAR JOGO");
		btnNewButton_1.setHorizontalTextPosition(SwingConstants.CENTER);
		btnNewButton_1.setPreferredSize(new Dimension(120, 100));
		OuvinteBotaoCarregarJogo ouvinte2 = new OuvinteBotaoCarregarJogo();
		btnNewButton_1.addActionListener(ouvinte2);
		panel.add(btnNewButton_1);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel.setIcon(new ImageIcon("D:\\images\\inicio.jpg"));
		janela.getContentPane().add(lblNewLabel, BorderLayout.NORTH);
	}
	
	class OuvinteBotaoNovoJogo implements ActionListener{
		@Override
		public void actionPerformed(ActionEvent arg0) {
			// TODO Auto-generated method stub
			janela.setVisible(false);
			janela.dispose();
			new GUInovojogo(mainInicio);
		}
	}
		
	class OuvinteBotaoCarregarJogo implements ActionListener{
		@Override
		public void actionPerformed(ActionEvent arg0) {
			// TODO Auto-generated method stub
			janela.setVisible(false);
			janela.dispose();
			new GUIcarregarjogo(mainInicio);
		}
	}
	
	/*public static void main (String[] args) {
		new GUIinicio();
	}*/

}
